#include "stdafx.h"

#include <QtWidgets/qwidget.h>
#include <QtWidgets/qboxlayout.h>
#include <QtWidgets/qlineedit.h>
#include <QtWidgets/qpushbutton.h>

#include "QEnvTableItem.h"
#include "QEnvTable.h"

QEnvTableItem::QEnvTableItem( const QEnvPath &path, QEnvTable * parent ) 
	: QTableWidgetItem( path ), mParent(parent)
{
	setPath( path );
}
QEnvTableItem::~QEnvTableItem(){
}

void QEnvTableItem::setPath( const QEnvPath &p ){ mPath = p; setText(p); }
const QEnvPath& QEnvTableItem::getPath() const{ return mPath; }

void QEnvTableItem::change()
{
	String str(QFileDialog::getExistingDirectory( qApp->activeWindow(), QObject::tr("Modify path"), getPath().path() ));
	if( str.empty() ) return;
	setPath( str.trimmed() );
}
